﻿using System.Web.Mvc;


namespace MShop.Web.Components.Partials
{
	public static class PartialRequestsExtensions
	{
		public static void RenderPartialRequest(this HtmlHelper html, string viewDataKey)
		{
			PartialRequest partial = html.ViewContext.ViewData.Eval(viewDataKey) as PartialRequest;
			if (partial != null)
			{
				partial.Invoke(html.ViewContext);
			}
            
		}

        public static void RenderPartialRequest(this HtmlHelper html, PartialRequest request)
        {
            if (request != null)
            {
                request.Invoke(html.ViewContext);
            }
        }
	}
}
